package com.sean.reflect.aop1;

import com.sean.reflect.aop1.Cal;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

public class MyInvocationHadler implements InvocationHandler {

    Object cal;

    public MyInvocationHadler(Cal cal) {
        this.cal = cal;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {

        System.out.println("Before");
        Object result = method.invoke(cal, args);
        System.out.println(result);
        System.out.println("After");
        return result;
    }
}
